package com.zm.order.service.impl;



import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zm.order.dao.OrderMapper;
import com.zm.order.model.Order;
import com.zm.order.service.OrderService;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class OrderServiceImpl  extends ServiceImpl<OrderMapper, Order> implements OrderService {
    @Override
    public Long createOrder(Long userId, Long productId) {
        Order order=new Order();
        order.setUserId(userId);
        order.setProductId(productId);
        order.setOrderNo("test-1231231");
        order.setOrderName("test");
        order.setAddTime(new Date());
        boolean insert = order.insert();
        if (insert){
            return order.getId();
        }
        return 0L;
    }
}
